const implAddress = getApp().globalData.implAddress;
Page({
  data: {
    name:'未登录',
  },
  userSetting:function(){
    if(this.data.name === '未登录'){
      this.login()
    }else{
      this.navToSetting()
    }
  },
  login(){
    const that = this
    wx.login({
      success: (res) => {
        const code = res.code
        if(code){
          //后端接口
          console.log(code)
          //更改显示名称
          that.setData({
            name:'微信用户'
          })
        }
      },
      fail:(err)=>{
        console.error(err)
      }
    })
  },
  navToSetting(){
    wx.navigateTo({
      url: '/pages/setting/setting'
    })
  },
  navToProtocol:function(){
    wx.navigateTo({
      url: '/pages/logs/logs',
    })
  }
})